Skip to content

Setup release workflow with trusted publisher#9852

Merged
browniebroke merged 13 commits intoencode:mainfrom
browniebroke:ci/trusted-publisher
Mar 4, 2026
Merged

Setup release workflow with trusted publisher#9852
browniebroke merged 13 commits intoencode:mainfrom
browniebroke:ci/trusted-publisher

Conversation

@browniebroke
Copy link
Member

Description

Following django-commons template. Trusted publisher has been configured in PyPI and Test PyPI.

Lifted out from #9782 to take advantage of it before the org move. It's time we make a new release, there are a number of unreleased changes, including a few which are making our updated upstream support official.

p-r-a-v-i-n

This comment was marked as outdated.

@browniebroke

This comment was marked as outdated.

@p-r-a-v-i-n

This comment was marked as outdated.

@browniebroke
Copy link
Member Author

browniebroke commented Dec 22, 2025

Since we’ve consolidated pre-commit into main.yml, IMO adding needs: pre-commit to the tests job would be nice. Currently, all jobs will run in parallel, but it would be better to make the tests depend on the pre-commit results to prevent unnecessary runs when there are linting errors.".

Having them run in parallel gives you more feedback when they both fail for different reasons, you can fix both in one go this way. What you're suggesting might have pre-commit hide a problem in tests which you would only discover after fixing the linting error.

I agree with your point here , But I assume people likely do testing of their code before pushing in most scenario, But most of time they forgot to run pre-commit locally. so in such scenario the test jobs will run two times which might be costlier.

I thought this would be a trivial change that didn't deserve its own pull request, but you having a differing viewpoint proved me that it's not that trivial, so I've moved this out of this change:

Will be a better place to discuss it - will hide the previous comment as outdated from here to not pollute this PR

@browniebroke
Copy link
Member Author

browniebroke commented Dec 23, 2025

Actually I should probably update the release process at the same time.

 Create pull request for [release notes](https://github.com/encode/django-rest-framework/blob/mains/docs/topics/release-notes.md) based on the [*.*.* milestone](https://github.com/encode/django-rest-framework/milestones/***).
 Update supported versions:
 Ensure the pull request increments the version to `*.*.*` in [`restframework/__init__.py`](https://github.com/encode/django-rest-framework/blob/main/rest_framework/__init__.py).
 Ensure documentation validates 
 Confirm that release is finalized and ready to go. 
 Ensure that release date is included in pull request.
 Merge the release pull request.
-Install the release tools: `pip install build twine`
-Build the package: `python -m build`
-Push the package to PyPI with `twine upload dist/*`
-Tag the release, with `git tag -a *.*.* -m 'version *.*.*'; git push --tags`.
-Deploy the documentation with `mkdocs gh-deploy`.
+Create the git tag
+Wait for the release workflow to run. It will build the distribution, upload it to Test PyPI, PyPI and create the GitHub release
 Make a release announcement on the [discussion group](https://groups.google.com/forum/?fromgroups#!forum/django-rest-framework).
-Make a release announcement on twitter.
+Make a release announcement on social media.
 Close the milestone on GitHub.

Edit: that's now done

@browniebroke browniebroke added the CI label Feb 5, 2026
@browniebroke browniebroke added this to the 3.17 milestone Feb 19, 2026
@browniebroke
Copy link
Member Author

@auvipy @peterthomassen I'm keen try get 3.17 released in the coming days and would like to try using this for it. I can't really test this until it's merged but it's pretty much the @django-commons template that's used on several projects, so should hopefully work 🤞🏻

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a GitHub Actions-based release workflow using PyPI “trusted publishing” (OIDC) and updates the release checklist docs to reflect the new automated publishing process.

Changes:

  • Introduces a tag-triggered release.yml workflow that builds artifacts, publishes to TestPyPI/PyPI, signs with Sigstore, and creates/uploads a GitHub Release.
  • Updates the release checklist in project management docs to align with the new workflow-driven release steps.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
docs/community/project-management.md Updates release checklist steps to rely on the new automated release workflow rather than manual twine/mkdocs gh-deploy steps.
.github/workflows/release.yml Adds the automated build/publish/sign/release pipeline for tagged releases using trusted publishing.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@auvipy
Copy link
Collaborator

auvipy commented Mar 3, 2026

I think I should also be invited to PyPI as an decade old contributor to DRF

@browniebroke
Copy link
Member Author

I think I should also be invited to PyPI as an decade old contributor to DRF

Fair enough. Done on PyPI and test PyPI - although this workflow is meant to remove the need to invite maintainers altogether

@browniebroke browniebroke requested a review from Copilot March 3, 2026 21:55
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@browniebroke browniebroke merged commit 9734f77 into encode:main Mar 4, 2026
7 checks passed
@browniebroke browniebroke deleted the ci/trusted-publisher branch March 4, 2026 13:09
@browniebroke browniebroke added Packaging and removed CI labels Mar 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants